<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap/dist/css/bootstrap.css" type="text/css" />
	<link rel="stylesheet" href="__ADMIN_STATICS__/animate.css/animate.css" type="text/css" />
	<link rel="stylesheet" href="__ADMIN_STATICS__/font-awesome/css/font-awesome.min.css" type="text/css" />
	<link rel="stylesheet" href="__ADMIN_STATICS__/simple-line-icons/css/simple-line-icons.css" type="text/css" />
	<link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap-editable/css/bootstrap-editable.min.css" type="text/css" />
	<link rel="stylesheet" href="__ADMIN_STATICS__/app/css/font.css" type="text/css" />
	<link rel="stylesheet" href="__ADMIN_STATICS__/app/css/app.css" type="text/css" />
</head>
<body>
<div class="wrapper-md">
   <div class="panel panel-default">
    <div class="panel-heading">
    <i class="fa fa-home"></i>&nbsp;首页&nbsp;&gt;&nbsp;&nbsp;导航管理
    <a href="{:U('Admin/HomeNav/add')}" class="btn btn-primary btn-xs menu-add pull-right">添加导航</a>
    </div>
    <div class="table-responsive">
		<table class="table table-bordered table-hover table-condensed b-t b-light">
			<thead>
				<tr>
				<th>导航名</th>
				<th>操作类型</th>
				<th>链接</th>
				<th width="80">排序</th>
				<th width="190">操作</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="data" item="v">
				<tr menuId="{$v.id}" pid="{$v.parentId}">
					<td><span class="menu-name">{$v['_name']}</span></td>
					<td>{$v['type_name']}</td>
					<td><span class="menu-url">{$v['mca']}</span></td>
					<td><span class="menu-sort">{$v['order_number']}</span></td>
					<td>
						<a href="{:U('Admin/HomeNav/add', array('pid'=>$v['id']))}" class="btn btn-default btn-xs menu-addchild">添加子导航</a>
						<a href="{:U('Admin/HomeNav/edit', array('id'=>$v['id']))}" class="btn btn-info btn-xs menu-edit">修改</a>
						<a class="btn btn-danger btn-xs menu-delete" href="javascript:if(confirm('确定删除？'))location='{:U('Admin/HomeNav/delete',array('id'=>$v['id']))}'">删除</a>
					</td>
				</tr>
				</foreach>
			</tbody>
		</table>
    </div>
  </div>
</div>
<script src="__ADMIN_STATICS__/jquery/jquery.min.js"></script>
<script src="__ADMIN_STATICS__/bootstrap/dist/js/bootstrap.js"></script>
<script src="__ADMIN_STATICS__/bootstrap-editable/js/bootstrap-editable.min.js"></script>
<script type="text/javascript">
$(function(){
	$.fn.editable.defaults.emptytext = '----';
	$('.menu-name').editable({
		url:'www.baidu.com',
		pk:1,
		params:function(data){
			console.log(data);
		}	
	});
	$('.menu-url').editable({
		
	});
	$('.menu-sort').editable({
		
	});
	$('.menu-show').editable({
		
	});
	$('.sort').click(function(){
		var id = $(this).parents('tr').attr('menuId');
		var a = $(this).find('a');
		var isShow = 0;
		if(a.hasClass('active')){
			isShow = 0;
			a.removeClass('active')
		}else{
			isShow = 1;
			a.addClass('active')
		}
		var para = {
				'menu.id':id,
				'menu.isShow':isShow
		}
		$ajax(para);
	});
	
	$ajax = function(para){
		$.post(updateUrl, para, function (data) {
			console.log(data);			
		});
	}
	
});
</script>
</body>
</html>
